class My implements Runnable{

    public void run(){
        for(int i = 0; i < 5; i++){
            if(i == 3){
                // use yield. dont know use for what
                Thread.currentThread().yield();
                System.out.println(Thread.currentThread().getName() + " yield!");
            }
            System.out.println(Thread.currentThread().getName() + " time: " + i);
        }
    }

}

public class Yield{

    public static void main(String[] args){

        My m = new My();
        Thread t1 = new Thread(m, "Thread 01");
        Thread t2 = new Thread(m, "Thread 02");

        t1.start();
        t2.start();

    }

}